package org.luckystrophe.snowtoms.model.impl;

import java.util.Date;

public class Reply {

	private long replyId;

	private long msgId;

	private long usrId;
	
	private String replyComment;

	private Date replyDate;

	private String loginType;

	private String collaboId;

	private String name;
	

	public Reply(long usrId, long replyId, long msgId, String replyComment, Date replyDate, String loginType, String collaboId,
			String name) {
		this.replyId = replyId;
		this.msgId = msgId;
		this.replyComment = replyComment;
		this.replyDate = replyDate;
		this.loginType = loginType;
		this.collaboId = collaboId;
		this.name = name;
		this.usrId = usrId;
	}

	public long getReplyId() {
		return replyId;
	}

	public long getMsgId() {
		return msgId;
	}

	public String getReplyComment() {
		return replyComment;
	}

	public String getReplyDate() {
		long compare = System.currentTimeMillis() - replyDate.getTime();
		long dComapre = compare / (24 * 60 * 60 * 1000);
		long hCompare = compare / (60 * 60 * 1000);
		long mCompare = compare / (60 * 1000);
		long sCompare = compare / 1000;

		if (dComapre > 0) {
			return dComapre + "일 전";

		} else if (hCompare > 0) {
			return hCompare + "시간 전";

		} else if (mCompare > 0) {
			return mCompare + "분 전";

		} else if (sCompare > 0) {
			return sCompare + "초 전";
		} else {
			return "방금 전";
		}
	}

	public String getLoginType() {
		return loginType;
	}

	public String getCollaboId() {
		return collaboId;
	}

	public String getName() {
		return name;
	}
	
	public long getUsrId(){
		return usrId;
	}

	public String getUsrImage() {
		if (loginType.equals("fb")) {
			return "https://graph.facebook.com/" + collaboId + "/picture?type=square";
		}
		return null;
	}
}
